package cn.nohan.funplay.module.member.mongo.service.notify;



import cn.nohan.funplay.module.member.mongo.service.notify.message.Message;
import com.mongoplus.annotation.ID;
import com.mongoplus.annotation.collection.CollectionField;
import com.mongoplus.annotation.collection.CollectionLogic;
import com.mongoplus.annotation.collection.CollectionName;
import com.mongoplus.enums.LogicDataType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * @author caozhipeng
 * @date 2025/8/13
 */
@CollectionName("system_message")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SystemMessage<T extends Message> {

    @ID
    private String id;
    /**
     * 用户编号
     */
    @CollectionField("userId")
    private Long userId;
    /**
     * 消息类型 枚举 { SystemMessageTypeEnum}
     */
    @CollectionField("messageType")
    private Integer messageType;
    /**
     * 消息内容
     */
    @CollectionField(value = "message")
    private T message;
    /**
     * 是否已读
     */
    @CollectionField("isRead")
    private Boolean isRead;
    /**
     * 已读时间
     */
    @CollectionField("readTime")
    private LocalDateTime readTime;
    /**
     * 创建时间
     */
    @CollectionField("createTime")
    private LocalDateTime createTime;
    /**
     * 删除时间
     */
    @CollectionField("deleted")
    @CollectionLogic(value ="true",delval = "false", delType = LogicDataType.BOOLEAN)
    private Boolean deleted;

    /**
     * 关联的id 关联的业务ID（比如提现记录ID、活动ID等，方便跳转）
     */
    @CollectionField("relatedId")
    private String relatedId;

}
